package tech.aistar.mapper;

import org.apache.ibatis.annotations.*;
import tech.aistar.entity.authordis.NoteAuthor;
import tech.aistar.entity.authordis.UserTable;
import tech.aistar.entity.notepay.NoteOrder;

import java.util.List;

/**
 * Created by Dell on 2019/10/1.
 */
@Mapper
public interface PersonInfoMapper {



    //查询用户信息
    @Select("select * from user_table where id = #{value}")
    UserTable getById(Integer id);

    //个人信息展示-钻石数和文章数
    @Select("select * from note_author where user_id = #{value}")
    NoteAuthor findUserInfoById(Integer user_id);

    //修改个人信息
    @Update("update user_table set username=#{username},sex=#{sex},usual_place=#{usualPlace},age=#{age},phone=#{phone},intro=#{intro} where id = ${id}")
    void saveUserTable(UserTable userTable);

    //上传头像
    @Update("update user_table set head_img = #{headImg} where id = #{id}")
    void saveHeadImg(@Param("id") Integer id, @Param("headImg") String headImg);

    //查询订单信息
    @Select("select * from note_order where user_id = #{value}")
    List<NoteOrder> findNoteOrder(Integer user_id);
}
